package com.bdqn.service.impl;

import com.bdqn.mapper.TransactionRecordMapper;
import com.bdqn.pojo.TransactionRecord;
import com.bdqn.service.TransactionRecordService;
import com.bdqn.util.Page;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * TransactionRecordServiceImpl
 *
 * @author 武子
 * @date 2024/10/31
 */
@Service
public class TransactionRecordServiceImpl implements TransactionRecordService {
    @Resource
    private TransactionRecordMapper transactionRecordMapper;

    /**
     * @param transactionRecord
     * @return
     */
    @Override
    public int conAdd(TransactionRecord transactionRecord) {
        return transactionRecordMapper.conAdd(transactionRecord);
    }

    /**
     * @param transactionRecord
     * @return
     */
    @Override
    public int incAdd(TransactionRecord transactionRecord) {
        return transactionRecordMapper.incAdd(transactionRecord);
    }

    /**
     * @param transactionDateA
     * @param transactionDateB
     * @param page
     * @return
     */
    @Override
    public List<TransactionRecord> listPage(String transactionDateA, String transactionDateB, Page<TransactionRecord> page) {
        Integer pageSize = page.getPageSize();
        Integer pageIndex = (page.getPageNo() - 1) * pageSize;
        return transactionRecordMapper.listPage(transactionDateA,transactionDateB,pageIndex,pageSize);
    }

    /**
     * @param transactionDateA
     * @param transactionDateB
     * @return
     */
    @Override
    public int count(String transactionDateA, String transactionDateB) {
        return transactionRecordMapper.count(transactionDateA,transactionDateB);
    }
}
